//
// UnaryIterativeMethod.h
// Abstract base class for iterative methods that take one argument.
//
// Author: Gabriel H. Barbuto (gbarbuto@dc.uba.ar)
//
#ifndef _UNARY_ITERATIVE_METHOD_H_
#define _UNARY_ITERATIVE_METHOD_H_

#include <cstddef>
#include <vector>

#include "IterativeMethod.h"
#include "TP1MetNumDLL.h"

class UnaryIterativeMethod : public IterativeMethod
{
public:

	TP1METNUMDLL_API UnaryIterativeMethod(std::size_t const &iterations);

	TP1METNUMDLL_API UnaryIterativeMethod(double const &epsilon = IterativeMethod::default_epsilon(), std::size_t const &iterations = IterativeMethod::default_iterations());

	TP1METNUMDLL_API double operator()(double const &x);

	TP1METNUMDLL_API virtual double operator()(std::vector<double> const &arguments) = 0;

protected:

	TP1METNUMDLL_API static inline std::size_t argument_count()
	{
		return 1;
	}

	TP1METNUMDLL_API virtual void check(std::vector<double> const &arguments) const;
};

#endif
